<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>MyClouds：企业级微服务开源平台</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<meta name="keywords" content="MyClouds|微服务开发平台|免费开源框架|Java快速开发框架">
		<meta name="description" content="MyClouds是一个基于SpringBoot/Cloud生态和JavaEE技术栈的企业级微服务开源平台（微服务快速开发框架 & 微服务治理工具集）。支持研发团队快速交付高质量、可扩展的企业分布式微服务应用。">
		<link rel="stylesheet" href="layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="layuiadmin/style/login.css" media="all">
		<link rel="shortcut icon" href="myadmin/img/favicon.ico" />
	</head>
	<body>
		<div class="login-wrapper">
			<div class="login-header">
				<img src="myadmin/img/logo.svg"> MyClouds企业级微服务平台
			</div>
			<div class="login-body">
				<div class="layui-card">
					<div class="layui-card-header">
						<i class="layui-icon layui-icon-user"></i> 系统身份认证
					</div>
					<form class="layui-card-body layui-form layui-form-pane">
						<div class="layui-form-item">
							<label class="layui-form-label"><i class="layui-icon layui-icon-username"></i></label>
							<div class="layui-input-block">
								<input name="account" type="text" placeholder="账号" class="layui-input" autocomplete="off" lay-verify="required"
								 lay-vertype="tips" />
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label"><i class="layui-icon layui-icon-password"></i></label>
							<div class="layui-input-block">
								<input name="password" type="password" placeholder="密码" class="layui-input" lay-verify="required" lay-vertype="tips" />
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label"><i class="layui-icon layui-icon-vercode"></i></label>
							<div class="layui-input-block">
								<div class="layui-row inline-block">
									<div class="layui-col-xs7">
										<input name="vercode" type="text" placeholder="验证码" class="layui-input" autocomplete="off" lay-vertype="tips" />
									</div>
									<div class="layui-col-xs5" style="padding-left: 6px;">
										<img class="login-captcha" src="https://www.oschina.net/action/user/captcha">
									</div>
								</div>
							</div>
						</div>
						<div class="layui-form-item">
							<a href="javascript:;" class="layui-link">帐号注册</a>
							<a href="javascript:;" class="layui-link pull-right">忘记密码？</a>
						</div>
						<div class="layui-form-item">
							<button id="login-submit" lay-filter="login-submit" class="layui-btn layui-btn-fluid" lay-submit type="button">登
								录</button>
						</div>
						<div class="layui-form-item login-other">
							<label>第三方登录</label>
							<a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
							<a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
							<a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>
						</div>
					</form>
				</div>
			</div>

			<div class="login-footer">
				<p>© MyClouds@Gitee 2008~2019 <a href="https://gitee.com/osworks/MyClouds/blob/master/LICENSE" target="_blank">Apache
						License
						2.0</a></p>
				<p>
					<span><a href="https://gitee.com/osworks/MyClouds" target="_blank">Gitee</a></span>
					<span><a href="https://github.com/xiongchun/myclouds" target="_blank">Github</a></span>
					<span><a href="https://gitee.com/osworks/MyClouds/tree/master/myclouds-docs" target="_blank">开发文档</a></span>
				</p>
			</div>
		</div>
	</body>

	<script src="layuiadmin/layui/layui.js"></script>
	<script>
		layui.config({
			base: 'layuiadmin/' //静态资源所在路径
		}).extend({
			index: 'lib/index' //主入口模块
		}).use(['index', 'myutil', 'form'], function() {
			var $ = layui.$,
				form = layui.form,
				util = layui.util,
				myutil = layui.myutil;

			$("form [name='account']").focus();
			$("form [name='account']").keydown(function(event) {
				if (event.keyCode == 13) {
					$("form [name='password']").focus();
				}
			});
			$("form [name='password']").keydown(function(event) {
				if (event.keyCode == 13) {
					$("form [name='vercode']").focus();
				}
			});
			$("form [name='vercode']").keydown(function(event) {
				if (event.keyCode == 13) {
					$("#login-submit").trigger("click");
				}
			});
			//登录提交
			form.on('submit(login-submit)', function(obj) {
				var data = obj.field;
				if (layui.setter.my.loginAs.account) {
					data.account = layui.setter.my.loginAs.account;
					data.password = layui.setter.my.loginAs.password;
				}
				data.device = JSON.stringify(layui.device()); //TEMP CODE
				myutil.ajax({
					url: layui.setter.my.surl + 'admin/system/auth/login',
					data: data,
					ok: function(res) {
						layui.sessionData('myAuth', {
							key: 'userVO',
							value: res.data
						});
						if (res.code == 0) {
							location.href = 'index.html';
						} else {
							if (res.code == 1) {
								var inputObj = $("form [name='account']");
								inputObj.select().focus();
								layer.tips(res.msg, inputObj, {
									tips: 1
								});
							} else if (res.code == 2) {
								var inputObj = $("form [name='password']");
								inputObj.select().focus();
								layer.tips(res.msg, inputObj, {
									tips: 1
								});
							} else if (res.code == 3) {
								var inputObj = $("form [name='vercode']");
								inputObj.select().focus();
								layer.tips(res.msg, inputObj, {
									tips: 1
								});
							} else {
								layer.msg(res.msg, {
									offset: '20px',
									icon: 5
								});
							}
						}

					}
				});
			});

			// 图形验证码
			$('.login-captcha').click(function() {
				this.src = this.src + '?t=' + (new Date).getTime();
			});

			if (layui.setter.my.runAs == 'demo') {
				layer.msg('登录账号：root&nbsp;&nbsp;密码：111111', {
					offset: '20px',
					icon: 6,
					time: 15000
				});
			}

		});
	</script>

</html>
